package com.woniu.controller;


import cn.hutool.core.bean.BeanUtil;
import com.woniu.commons.exception.YogaException;
import com.woniu.commons.model.Result;
import com.woniu.model.model.YGoodsItem;
import com.woniu.service.YGoodsItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 胡歌
 * @since 2024年05月28日
 */
@RestController
@RequestMapping("/yGoodsItem")
@Api(tags = "商城订单详情的接口")
public class YGoodsItemController {


    @Resource
    private YGoodsItemService goodsItemService;

    /**
     * 通过订单ID查询多个订单信息
     * @param orderNum 订单编号
     * @return
     * @throws YogaException
     */
    @PostMapping("/listByOrderItem")
    @ApiOperation(value = "通过订单ID查询多个订单信息")
    public Result<List<YGoodsItem>> listByClassType(@RequestBody String orderNum) throws YogaException {
        List<YGoodsItem> goodsItems = goodsItemService.listByClassType(orderNum);
        return Result.newListInstance(YGoodsItem.class).setData(goodsItems).setCode(200).setMsg("查询成功");
    }
}

